#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
using namespace std;
int n, m, i, j;
int a, b, sum, ans;
int months[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 };
int main()
{
	cin >> n >> m;
	for (i = 1; i <= 12; i++) {
		for (j = 1; j <= months[i]; j++) {
			a = (i / 10) +
				(i % 10) * 10 +
				(j / 10) * 100 +
				(j % 10) * 1000;
			sum = a * 10000 + i * 100 + j;
			if (sum<n || sum>m)continue;
			ans++;
		}
	}
	cout << ans;
	return 0;
}